package com.lifa.service.impl;
/**
 * 123
 */
import com.lifa.dao.ChanpinsDao;
import com.lifa.entity.Chanpin;
import com.lifa.service.ChanpinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ChanpinServiceImpl implements ChanpinService {
    @Autowired
    private ChanpinService chanpinService;
    @Autowired
    private ChanpinsDao chanpinDao;

    @Override
    public List<Chanpin> chax1() {
        return chanpinDao.chax();
    }

    /**
     * 查询全部
     * @return
     */
    public List<Chanpin> list() {
        return chanpinService.list();
    }

    /**
     * 根据id删除产品信息
     * @param shangpin_Id
     * @return
     */
    @Override
    public int delete(int shangpin_Id) {
        return chanpinDao.delete(shangpin_Id);
    }

    /**
     * 添加产品
     * @param chanpin
     * @return
     */
    @Override
    public int add(Chanpin chanpin) {
        return chanpinDao.add(chanpin);
    }

    /**
     * 修改产品信息
     * @param chanpin
     * @return
     */
    @Override
    public int xiugai(Chanpin chanpin) {
        return chanpinDao.xiugai(chanpin);
    }

    /**
     * 根据产品id查询
     * @param shangpin_Id
     * @return
     */
    @Override
    public Chanpin queryId(int shangpin_Id) {
        return chanpinDao.queryId(shangpin_Id);
    }

    /**
     * 分页
     * @param name
     * @param offset
     * @param limit
     * @return
     */
    @Override
    public List<Chanpin> findAll(String name, int offset, int limit) {
        return chanpinDao.queryPage(name,offset,limit);
    }

    /**
     * 查询总条数
     * @param name
     * @return
     */
    @Override
    public int findTotalCount(String name) {
        return chanpinDao.getTotalCount(name);
    }
}
